package com.battle.service.utils;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

/**
 * @author Joseph.Li
 * @author joseph.li@king-v.com
 * Created in 2022-07-08 22:32
 *
 * 密码工具
 */
public abstract class PasswordUtil {


    //

    /**
     *  加密密码
     * @param id
     * @param password
     * @return
     */
    public static String passwordBcryptEncode(String id,String password){
        return new BCryptPasswordEncoder().encode(id + password);
    }

    //

    /**
     * 验证密码
     * @param rawPassword  new
     * @param encodePassword old
     * @return
     */
    public static Boolean passwordConfirm(String rawPassword,String encodePassword){
        return new BCryptPasswordEncoder().matches(rawPassword,encodePassword);
    }
}
